package com.gxa.xly2024.controller;

import com.gxa.xly2024.pojo.Purchase;
import com.gxa.xly2024.pojo.Sell;
import com.gxa.xly2024.service.impl.PurchaseServiceImpl;
import com.gxa.xly2024.service.impl.SellServiceImpl;
import com.gxa.xly2024.vo.VO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/sell")
public class SellController {

    @Resource
    private SellServiceImpl sellService;

    @GetMapping("/selectSellById")
    public Map<String, Object> selectSell(Integer id) {
        return this.sellService.selectSellById(id);
    }

    @GetMapping("/selectSellByLimit")
    public Map<String, Object> selectSellByLimit(VO vo) {
        return this.sellService.selectSellByLimit(vo);
    }

    @PostMapping("/insert_Sell")
    public Map<String, Object> insert(@RequestBody Sell sell) {   // 接收前端传递的json对象
        return this.sellService.insert(sell);
    }

    @PostMapping("/updateById_Sell")
    public Map<String, Object> updateById(@RequestBody Sell sell) {   // 接收前端传递的json对象
        return this.sellService.updateById(sell);
    }
    @PostMapping("/deleteById_Sell")
    public Map<String, Object> deleteById(Integer id) {   // 接收前端传递的json对象
        return this.sellService.deleteById(id);
    }
}
